﻿@model ESupervision.Models.Message

@{
    ViewBag.Title = "Messaging - Read";
}


<h2>Messaging - Read</h2>


<div class="row">
    <div class="col-md-2">
        <p>
            <button type="button" class="btn btn-warning" onclick="location.href='@Url.Action("Compose")'">Compose</button>

        </p>
        <ul class="nav nav-pills nav-stacked">
            @if (ViewBag.Current == "Inbox")
            { 
                <li role="presentation" class="active"><a href="@Url.Action("Index")">Inbox</a></li>
                <li role="presentation"><a href="@Url.Action("Sent")">Sent</a></li>
            }
            else
            {
                <li role="presentation"><a href="@Url.Action("Index")">Inbox</a></li>
                <li role="presentation" class="active"><a href="@Url.Action("Sent")">Sent</a></li>
            }
        </ul>

    </div>
  
        <div class="col-md-10">
            <div class="btn-group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">Actions <span class="caret"></span></button>
                <ul class="dropdown-menu" role="menu">
                    @if (Request["rId"] != null) { 
                        <li>@Html.ActionLink("Delete", "Delete", new { id = Model.ID, rId = Request["rId"] })</li>
                        <li>@Html.ActionLink("Reply", "Reply", new { id = Model.ID, rId = Request["rId"] })</li>
                    }
                    else
                    {
                         if (Request["sId"] != null) { 
                            <li>@Html.ActionLink("Delete", "Delete", new { id = Model.ID, sId = Request["sId"] })</li>
                            <li>@Html.ActionLink("Reply", "Reply", new { id = Model.ID, sId = Request["sId"] })</li>
                        }
                        
                    }
                </ul>
            </div>
            <div>
                <h4>
                    @Html.DisplayFor(model => model.Subject)
                </h4>
            </div>
            <div>
                <div class="col-md-2">From</div>
                <div class="col-md-10">@Html.DisplayFor(model => model.Sender.FullName)</div>
                <div class="col-md-2">To</div>
                <div class="col-md-10">@{
                        foreach (var messageRecipient in Model.MessageRecipients)
                        {
                            @messageRecipient.ReceiverUser.FullName <br />
                        }
                }</div>
            </div>
            <div>
                @Html.DisplayFor(model => model.Body)
            </div>
        </div>
   
</div>
